/**
 * Created by zhuyufeng on 2016/1/2.
 */
Ext.define('eleModel', {
	extend: 'Ext.data.Model',
	fields: [ 'num','ele']
});
var eleStore = Ext.create('Ext.data.Store', {
	model: 'eleModel',
	autoLoad: true,
	pageSize: 10,
	proxy: {
		type: 'ajax',
		url : './json/ele',
		reader: {
			type: 'json',
			root: 'rows',
			totalProperty: 'total'
		}
	}
});
var ele = Ext.create('Ext.grid.Panel', {
	region:'center',
	split:false,
	border:true,
	collapsible:false,
	activeTab:0,
	autoHeight:true,
	title:'发布公告',
	store: eleStore,
	height:280,
	forceFit:true,
	selType:'cellmodel',
	columns: [
		{text: '寝室号',width: 100,dataIndex: 'num'},
		{text: '电费(/元)',width: 150,dataIndex: 'ele',editor:'textfield'}
	],
	plugins:[
		Ext.create('Ext.grid.plugin.CellEditing', {
			clicksToEdit: 1
		})
	],
	dockedItems:[{
		xtype:'pagingtoolbar',
		store:eleStore,
		dock:'bottom',
		displayInfo:true,
		displayMsg:'第{0}条到第{1}条,一共{2}条',
		emptyMsg:'没有记录'
	}],
	bbar:[{
		xtype:'button',
		text:'发布',
		buttonAlign:'center',
		handler:function(){}
	}]
});